home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-21 | 695 b | 31 lines |
- import vrml.*;
- import vs.*;
-
- public class flash extends Script {
- SFNode nBALL = (SFNode)getField("shBALL");
- Shape shBALL = (Shape)nBALL.getValue();
- float coRED[] = new float[3];
- float coBLUE[] = new float[3];
- boolean isRed = true;
-
- public flash() {
- coRED[0] = 1.0f;
- coRED[1] = 0.0f;
- coRED[2] = 0.0f;
- coBLUE[0] = 0.0f;
- coBLUE[1] = 0.0f;
- coBLUE[2] = 1.0f;
- }
-
- public void clicked(ConstSFBool ev, ConstSFTime time) {
- if (ev.getValue() == true) {
- if (isRed == true) {
- shBALL.setColor(Shape.diffuse, coBLUE);
- } else {
- shBALL.setColor(Shape.diffuse, coRED);
- }
- isRed = !isRed;
- }
- }
- }
-